﻿/*********************************************************************************
**                                                                              **
**  Copyright (C) 2021-2025 LiLong                                              **
**  This file is part of CommonUnits.                                           **
**                                                                              **
**  CommonUnits is free software: you can redistribute it and/or modify         **
**  it under the terms of the GNU Lesser General Public License as published by **
**  the Free Software Foundation, either version 3 of the License, or           **
**  (at your option) any later version.                                         **
**                                                                              **
**  CommonUnits is distributed in the hope that it will be useful,              **
**  but WITHOUT ANY WARRANTY; without even the implied warranty of              **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               **
**  GNU Lesser General Public License for more details.                         **
**                                                                              **
**  You should have received a copy of the GNU Lesser General Public License    **
**  along with CommonUnits.  If not, see <https://www.gnu.org/licenses/>.       **
**********************************************************************************/
#pragma once
#include "../CommonUnits.h"
#include "../UnitLists.h"

namespace CU
{
inline namespace Inductance
{
namespace Units
{
using H              = StandardUnit<"H">;
using mH             = DeriveUnit<H, "mH", std::milli>;
using uH             = DeriveUnit<H, "μH", std::micro>;
using nH             = DeriveUnit<H, "nH", std::nano>;
using pH             = DeriveUnit<H, "pH", std::pico>;
using fH             = DeriveUnit<H, "fH", std::femto>;
using aH             = DeriveUnit<H, "aH", std::atto>;
using kH             = DeriveUnit<H, "kH", std::kilo>;
using MH             = DeriveUnit<H, "MH", std::mega>;
using GH             = DeriveUnit<H, "GH", std::giga>;
using TH             = DeriveUnit<H, "TH", std::tera>;
using PH             = DeriveUnit<H, "PH", std::peta>;
using EH             = DeriveUnit<H, "EH", std::exa>;
using InductanceList = UnitLists<aH, fH, pH, nH, uH, mH, H, kH, MH, GH, TH, PH, EH>;
} // namespace Units
using Henry      = CommonUnits<double, Units::H>;
using Millihenry = CommonUnits<double, Units::mH>;
using Microhenry = CommonUnits<double, Units::uH>;
using Nanohenry  = CommonUnits<double, Units::nH>;
using Picohenry  = CommonUnits<double, Units::pH>;
using Femtohenry = CommonUnits<double, Units::fH>;
using Attohenry  = CommonUnits<double, Units::aH>;
using Kilohenry  = CommonUnits<double, Units::kH>;
using Megahenry  = CommonUnits<double, Units::MH>;
using Gigahenry  = CommonUnits<double, Units::GH>;
using Terahenry  = CommonUnits<double, Units::TH>;
using Petahenry  = CommonUnits<double, Units::PH>;
using Exahenry   = CommonUnits<double, Units::EH>;

namespace Literals
{
inline namespace InductanceLiterals
{
constexpr Henry operator"" _H(long double value) { return Henry(static_cast<double>(value)); }
constexpr Henry operator"" _H(unsigned long long value) { return Henry(static_cast<double>(value)); }
constexpr Millihenry operator"" _mH(long double value) { return Millihenry(static_cast<double>(value)); }
constexpr Millihenry operator"" _mH(unsigned long long value) { return Millihenry(static_cast<double>(value)); }
constexpr Microhenry operator"" _uH(long double value) { return Microhenry(static_cast<double>(value)); }
constexpr Microhenry operator"" _uH(unsigned long long value) { return Microhenry(static_cast<double>(value)); }
constexpr Nanohenry operator"" _nH(long double value) { return Nanohenry(static_cast<double>(value)); }
constexpr Nanohenry operator"" _nH(unsigned long long value) { return Nanohenry(static_cast<double>(value)); }
constexpr Picohenry operator"" _pH(long double value) { return Picohenry(static_cast<double>(value)); }
constexpr Picohenry operator"" _pH(unsigned long long value) { return Picohenry(static_cast<double>(value)); }
constexpr Femtohenry operator"" _fH(long double value) { return Femtohenry(static_cast<double>(value)); }
constexpr Femtohenry operator"" _fH(unsigned long long value) { return Femtohenry(static_cast<double>(value)); }
constexpr Attohenry operator"" _aH(long double value) { return Attohenry(static_cast<double>(value)); }
constexpr Attohenry operator"" _aH(unsigned long long value) { return Attohenry(static_cast<double>(value)); }
constexpr Kilohenry operator"" _kH(long double value) { return Kilohenry(static_cast<double>(value)); }
constexpr Kilohenry operator"" _kH(unsigned long long value) { return Kilohenry(static_cast<double>(value)); }
constexpr Megahenry operator"" _MH(long double value) { return Megahenry(static_cast<double>(value)); }
constexpr Megahenry operator"" _MH(unsigned long long value) { return Megahenry(static_cast<double>(value)); }
constexpr Gigahenry operator"" _GH(long double value) { return Gigahenry(static_cast<double>(value)); }
constexpr Gigahenry operator"" _GH(unsigned long long value) { return Gigahenry(static_cast<double>(value)); }
constexpr Terahenry operator"" _TH(long double value) { return Terahenry(static_cast<double>(value)); }
constexpr Terahenry operator"" _TH(unsigned long long value) { return Terahenry(static_cast<double>(value)); }
constexpr Petahenry operator"" _PH(long double value) { return Petahenry(static_cast<double>(value)); }
constexpr Petahenry operator"" _PH(unsigned long long value) { return Petahenry(static_cast<double>(value)); }
constexpr Exahenry operator"" _EH(long double value) { return Exahenry(static_cast<double>(value)); }
constexpr Exahenry operator"" _EH(unsigned long long value) { return Exahenry(static_cast<double>(value)); }

} // namespace InductanceLiterals
} // namespace Literals
template<typename Unit>
inline auto toUnit(double value, const std::string& dest) -> Unit
{
    return toUnitHelper<Unit, Units::InductanceList>(value, dest);
}
} // namespace Inductance
} // namespace CU